<script>
	export default {
		globalData: {
			imgurl: '../../static/images/',
			imgurls: '../../../static/images/',
			userInfo: null,
			wenid: '',
			id: '',
			tiid: '',
			isok: false,
			unionid: null,
			flag: 1,
			index: '',
			len: '', 
			typewj: '' //导入问卷 类型判断
		},
		onLaunch: function() {
			// 小程序主动更新
			let _this = this;
			_this.updateManager();
			uni.getSetting({
				success: (res) => {
					if (res.authSetting["scope.userInfo"]) {
						uni.getUserInfo({
							success: (res) => {
								var that = this
								this.globalData.userInfo = res.userInfo;
							}
						})
					} else {

					}
				},
			})
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		},
		methods: {
			/**
			   * 小程序主动更新
			   */
			updateManager() {
				console.log('进入更新方法')
				if (!uni.canIUse('getUpdateManager')) {
				  console.log('不支持更新事件')
				  return false;
				}
				const updateManager = uni.getUpdateManager();
				updateManager.onCheckForUpdate(function (res) {
				  // 请求完新版本信息的回调
				  console.log(res.hasUpdate);
				});
				updateManager.onUpdateReady(function (res) {
				  uni.showModal({
				    title: '更新提示',
				    content: '新版本已经准备好，是否重启应用？',
				    success(res) {
				      if (res.confirm) {
				        // 新的版本已经下载好，调用 applyUpdate 应用新版本并重启
				        updateManager.applyUpdate();
				      }
				    }
				  });
				});

				updateManager.onUpdateFailed(function (res) {
				  // 新的版本下载失败
				  uni.showModal({
					title: '更新提示',
					content: '新版本下载失败',
					showCancel: false
				  })
				});
			},
		}
	}
</script>

<style>
	/*公共样式*/
	/* page {
		font-family: PingFang SC
	} */
	page,
	input {
	  font-family: PingFang SC Medium,
	    Heiti,
	    Heiti SC,
	    DroidSans,
	    DroidSansFallback,
	    "Microsoft YaHei",
	    sans-serif;
	  -webkit-font-smoothing: antialiased;
	  -moz-osx-font-smoothing: grayscale;
	}
	
	.show,
	.block {
	  display: block;
	}
	
	.hide {
	  display: none;
	}
	
	.inline{
	  display: inline-block;
	}
	
	.bold {
	  font-weight: bold;
	}
	
	.heavy{
	  font-weight: 500;
	}
	
	.height {
	  height: 112rpx;
	}
	
	.placeholder {
	  color: #C2C2C2;
	  font-size: 30rpx;
	  font-family: PingFang SC Medium,
	    Heiti,
	    Heiti SC,
	    DroidSans,
	    DroidSansFallback,
	    "Microsoft YaHei",
	    sans-serif;
	  -webkit-font-smoothing: antialiased;
	  -moz-osx-font-smoothing: grayscale;
	}
	
	.sizing {
	  box-sizing: border-box;
	}

	.flex {
		display: flex;
		align-items: center;
	}

	.row {
		display: flex;
		flex-direction: column;
		align-items: center;
	}
</style>
